#pragma once
#include"HashTable.h"

template<class K, class HashFun = Hash<K>>
class unordered_set
{
	struct SetKeyOfT
	{
		const K& operator()(const K& key)
		{
			return key;//
		}
	};
public:
	typedef typename LinkHash::HashTable<K, K, SetKeyOfT, HashFun>::iterator iterator;
	typedef typename LinkHash::HashTable<K, K, SetKeyOfT, HashFun>::iterator const_iterator;

	iterator begin()
	{
		return _ht.begin();
	}

	iterator end()
	{
		return _ht.end();
	}

	pair<iterator, bool> insert(const K& key)
	{
		return _ht.Insert(key);
	}
private:
	LinkHash::HashTable<K, K, SetKeyOfT, HashFun> _ht;
};

void set_test()
{
	unordered_set<int> us;
	for (size_t i = 0; i < 100; ++i)
	{
		us.insert(i);
	}

	auto it = us.begin();
	while (it != us.end())
	{
		cout << *it << " ";
		++it;
	}
	cout << endl;
}